﻿Shader "Custom/FlagETC1" {
	Properties {
		_Color ("Color", Color) = (1,1,1,1)
		_MainTex ("Color (RGB)", 2D) = "white" {}
		_AlphaTex ("Alpha (A)", 2D) = "white" {}
	}
	SubShader {
        Tags {"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent"}
		LOD 200
		
		CGPROGRAM
		#pragma surface surf Lambert vertex:vert alpha:fade

		sampler2D _MainTex;
		sampler2D _AlphaTex;

		struct Input {
			float2 uv_MainTex;
            float4 color;
		};

		void vert(inout appdata_full v, out Input o)  
        {  
            UNITY_INITIALIZE_OUTPUT(Input,o);

            o.color = v.color;
        } 

		fixed4 _Color;
		
		void surf (Input IN, inout SurfaceOutput o) {
			fixed3 c = tex2D (_MainTex, IN.uv_MainTex).rgb * IN.color.rgb * _Color.rgb;
			fixed a = tex2D (_AlphaTex, IN.uv_MainTex).r * IN.color.a * _Color.a;
				
			o.Albedo = c.rgb;
			o.Alpha = a;
		}
		ENDCG
	}
	FallBack "Diffuse"
}
